﻿using System;
using System.Windows.Forms;
using System.IO;

namespace Appsters
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
           
            string myDocuments = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string profPic = System.IO.Path.Combine(myDocuments, "Jotter\\Display Picture\\Profile.jpeg");
            string nameFile = System.IO.Path.Combine(myDocuments, "Jotter\\Saved Files\\Log In Details\\Name.txt");
            string descFile = System.IO.Path.Combine(myDocuments, "Jotter\\Saved Files\\Log In Details\\Description.txt");

            bool picExists = false;
            bool nameEmpty = false;
            bool descEmpty = false;

            if (File.Exists(profPic) == true)
            {
                picExists = true;
            }

            if(File.Exists(nameFile) ==  true)
            {
                if(new FileInfo(nameFile).Length == 0)
                {
                    nameEmpty = true;
                }               

            }

            if (File.Exists(descFile) == true)
            {
                if (new FileInfo(descFile).Length == 0)
                {
                    descEmpty = true;
                } 
            }

            if((picExists == true) & (nameEmpty == false) & (descEmpty == false))
            {
                Application.Run(new profView());
            }
            else 
            {
                Application.Run(new JotFrame());               
            }
        }
    }
}
